package ranger.clips
{
    import com.lowke.animator.Animator;
    import com.lowke.animator.effect.PlayFramesFX;
    import com.lowke.animator.effect.VelocityFX;

    public class Asteroid extends Clip
    {
        public function Asteroid(stAssetName:String)
        {
            super(stAssetName, true);
            
            // random fps
            var fps:Number = randomInt(2, 60)*(randomInt(0, 1) ? 1 : -1);
            _anime.addEffect(PlayFramesFX.fps(fps));
            
            // random x & y velocity
            var velocityX:Number = randomInt(1, 150)/1000*(randomInt(0, 1) ? 1 : -1);
            _anime.addEffect(new VelocityFX('x', velocityX, width, RussellStarling.WIDTH + width, false, Animator.TYPE_CYCLE));
            var velocityY:Number = randomInt(1, 150)/1000*(randomInt(0, 1) ? 1 : -1);
            _anime.addEffect(new VelocityFX('y', velocityY, -height, RussellStarling.HEIGHT + height, false, Animator.TYPE_CYCLE));
            
            // random rotation and angular velocity
            rotation = randomInt(0, 360);
            var angularVelocity:Number = randomInt(1, 100)/10000*(randomInt(0, 1) ? 1 : -1);
            _anime.addEffect(new VelocityFX('rotation', angularVelocity, 0, 360, false, Animator.TYPE_CYCLE));
        }
    }
}